load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_test")

go_library(
    name = "roachtest_lib",
    testonly = 1,
    srcs = [
        "cluster.go",
        "dynamic_cluster.go",
        "github.go",
        "main.go",
        "monitor.go",
        "operation_impl.go",
        "run.go",
        "slack.go",
        "test_filter.go",
        "test_impl.go",
        "test_registry.go",
        "test_runner.go",
        "work_pool.go",
        "zip_util.go",
    ],
    importpath = "github.com/cockroachdb/cockroach/pkg/cmd/roachtest",
    visibility = ["//visibility:private"],
    deps = [
        "//pkg/build",
        "//pkg/cmd/bazci/githubpost/issues",
        "//pkg/cmd/roachprod/grafana",
        "//pkg/cmd/roachtest/cluster",
        "//pkg/cmd/roachtest/operation",
        "//pkg/cmd/roachtest/operations",
        "//pkg/cmd/roachtest/option",
        "//pkg/cmd/roachtest/registry",
        "//pkg/cmd/roachtest/roachtestflags",
        "//pkg/cmd/roachtest/roachtestutil",
        "//pkg/cmd/roachtest/roachtestutil/operations",
        "//pkg/cmd/roachtest/spec",
        "//pkg/cmd/roachtest/test",
        "//pkg/cmd/roachtest/tests",
        "//pkg/cmd/roachtest/testselector",
        "//pkg/internal/team",
        "//pkg/roachprod",
        "//pkg/roachprod/cloud",
        "//pkg/roachprod/config",
        "//pkg/roachprod/errors",
        "//pkg/roachprod/install",
        "//pkg/roachprod/logger",
        "//pkg/roachprod/prometheus",
        "//pkg/roachprod/vm",
        "//pkg/roachprod/vm/gce",
        "//pkg/testutils/skip",
        "//pkg/util/allstacks",
        "//pkg/util/ctxgroup",
        "//pkg/util/httputil",
        "//pkg/util/leaktest",
        "//pkg/util/log",
        "//pkg/util/log/logconfig",
        "//pkg/util/log/logpb",
        "//pkg/util/quotapool",
        "//pkg/util/randutil",
        "//pkg/util/stop",
        "//pkg/util/syncutil",
        "//pkg/util/timeutil",
        "//pkg/util/version",
        "@com_github_cockroachdb_errors//:errors",
        "@com_github_datadog_datadog_api_client_go_v2//api/datadog",
        "@com_github_datadog_datadog_api_client_go_v2//api/datadogV1",
        "@com_github_dataexmachina_dev_side_eye_go//sideeyeclient",
        "@com_github_lib_pq//:pq",
        "@com_github_petermattis_goid//:goid",
        "@com_github_prometheus_client_golang//prometheus",
        "@com_github_prometheus_client_golang//prometheus/promauto",
        "@com_github_prometheus_client_golang//prometheus/promhttp",
        "@com_github_slack_go_slack//:slack",
        "@com_github_spf13_cobra//:cobra",
        "@in_gopkg_yaml_v2//:yaml_v2",
        "@org_golang_x_sync//errgroup",
        "@org_golang_x_sys//unix",
    ],
)

go_binary(
    name = "roachtest",
    testonly = 1,
    embed = [":roachtest_lib"],
    visibility = ["//visibility:public"],
)

go_test(
    name = "roachtest_test",
    size = "small",
    testonly = 1,
    srcs = [
        "cluster_test.go",
        "github_test.go",
        "main_test.go",
        "test_filter_test.go",
        "test_impl_test.go",
        "test_registry_test.go",
        "test_test.go",
        "zip_util_test.go",
    ],
    data = glob(["testdata/**"]),
    embed = [":roachtest_lib"],
    deps = [
        "//pkg/cmd/bazci/githubpost/issues",
        "//pkg/cmd/roachtest/cluster",
        "//pkg/cmd/roachtest/option",
        "//pkg/cmd/roachtest/registry",
        "//pkg/cmd/roachtest/roachtestflags",
        "//pkg/cmd/roachtest/spec",
        "//pkg/cmd/roachtest/test",
        "//pkg/internal/team",
        "//pkg/roachprod",
        "//pkg/roachprod/cloud",
        "//pkg/roachprod/errors",
        "//pkg/roachprod/logger",
        "//pkg/roachprod/vm",
        "//pkg/roachprod/vm/azure",
        "//pkg/testutils",
        "//pkg/testutils/datapathutils",
        "//pkg/testutils/echotest",
        "//pkg/util/stop",
        "//pkg/util/syncutil",
        "//pkg/util/version",
        "@com_github_cockroachdb_datadriven//:datadriven",
        "@com_github_cockroachdb_errors//:errors",
        "@com_github_kr_pretty//:pretty",
        "@com_github_prometheus_client_golang//prometheus",
        "@com_github_stretchr_testify//assert",
        "@com_github_stretchr_testify//require",
    ],
)
